package com.jblv.frame.demo.kafka;

import com.jblv.frame.common.kafka.KafkaProducerUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author happyonion.yangtao
 * @version 1.0
 * @title ApacheKfaka
 * @projectName jblv-frame
 * @packageName com.jblv.web.kafka
 * @description
 * @date Create at 2020/4/17 13:48
 * @since jdk1.8
 */
@RestController
@RequestMapping("/apache")
public class ApacheKafkaController {


    @ResponseBody
    @RequestMapping("/")
    public boolean index() {

        String topic = "kafka-topic2";
        String abc = "abc";
        boolean is = false;
        for(int i=0;i<5;i++) {
            is = KafkaProducerUtils.newInstance().send(abc, topic);
        }
        return is;
    }
}
